<ng-template #template>
  <div [class]="model.cssClasses.tableWrapper" #contentElement>
    <fieldset role="radiogroup">
      <legend class="sv-visuallyhidden">{{model.locTitle.renderedHtml}}</legend>
      <table [class]="model.getTableCss()" role="presentation">
        <thead *ngIf="model.showHeader" role="presentation">
          <tr>
            <td *ngIf="model.hasRows"></td>
            <th
              *ngFor="let column of model.visibleColumns" [style]="{ minWidth: model.columnMinWidth, width: model.columnMinWidth }" [class]="model.cssClasses.headerCell">
              <ng-template [component]="{ name: model.getColumnHeaderWrapperComponentName(column), data: { componentData: model.getColumnHeaderWrapperComponentData(column) } }">
                <sv-ng-string [model]="column.locText"></sv-ng-string>
              </ng-template>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let row of model.visibleRows; trackBy: trackRowByFn " [class]="row.rowClasses || undefined">
           <td [class]="row.rowTextClasses" [style]="{ minWidth: model.rowTitleWidth, width: model.rowTitleWidth }" *ngIf="model.hasRows">
              <ng-template [component]="{ name: model.getRowHeaderWrapperComponentName($any(row)), data: { componentData: model.getRowHeaderWrapperComponentData($any(row)) } }">
                <sv-ng-string [model]="row.locText"></sv-ng-string>
              </ng-template>
            </td>
            <ng-container *ngIf="model.hasCellText">
              <td *ngFor="let column of model.visibleColumns"
                [class]="model.getItemClass(row, column)"
                (click)="onCellChanged(row, column)" [model]="model.getCellDisplayLocText(row.name, column)" sv-ng-string>
              </td>
            </ng-container>
            <ng-container *ngIf="!model.hasCellText">
              <td
              *ngFor="let column of model.visibleColumns; index as columnIndex; trackBy: trackColumnByFn"
              [attr.data-responsive-title]="column.locText.renderedHtml"
              [class]="model.cssClasses.cell">
                <ng-template [component]="{ name: model.cellComponent, data: { cellChangedOwner: this, question: model, row: row, column: column, columnIndex: columnIndex } }"></ng-template>
              </td>
            </ng-container>
          </tr>
        </tbody>
      </table>
    </fieldset>
  </div>
</ng-template>